import React from 'react'
import { Navigate } from 'react-router-dom'


// 封装公共逻辑组件  成为路由拦截 
const AuthRoute = (props) => {
    // 判断是否登录
    const token = localStorage.getItem('token')
    if(token) {
        return props.children
    }else {
        return <Navigate to='/login'/>
    }

}

export default AuthRoute